package com.zx.task.manager.enums;

import lombok.Getter;

/**
 * <p>
 * description: 任务操作类型枚举定义 <br>
 * create: 2025-10-13 20:15
 * </p>
 *
 * @author zhou  xun
 */
@Getter
public enum TaskOperationTypeEnum {
    CREATE(1, "创建"),
    EDIT(2, "编辑"),
    PUBLISH(3, "发布"),
    CLAIM(4, "签收"),
    PROGRESS_UPDATE(5, "进度更新"),
    COMPLETE(6, "完成"),
    CLOSE(7, "关闭"),
    CANCEL(8, "取消"),
    REASSIGN(9, "转派");

    /**
     * code
     */
    private final Integer code;
    /**
     * 说明
     */
    private final String desc;

    TaskOperationTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static TaskOperationTypeEnum getEnumByDesc(String desc) {
        for (TaskOperationTypeEnum value : values()) {
            if (value.desc.equals(desc)) {
                return value;
            }
        }
        return null;
    }

    public static TaskOperationTypeEnum getEnumByCode(Integer code) {
        for (TaskOperationTypeEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}